home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / lib / objcol2 / sample / test5.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-12  |  891 b   |  36 lines

  1. /* Sample of "sort.o", linked with sort.o
  2.                            By SAKU     */
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <time.h>
  6. #include "sort.h"
  7.  
  8. #define DATAMAX    200    /* 580以上にするとおかしくなる。(コンパイラの仕様?) */
  9.  
  10. void    main()
  11. {
  12.     int        i,lank[DATAMAX];
  13.     unsigned short int    data[DATAMAX];
  14.     time_t    tms,tme;
  15.  
  16.     printf( "少々時間がかかります\n" );
  17.  
  18.     srand(DATAMAX);
  19.     for( i=0; i<DATAMAX; i++ )
  20.         data[i] = rand();
  21.  
  22.     time( &tms );
  23.     for( i=0; i<100; i++ )
  24.         sort( SORT_BUBBLE, SORT_SHORT, data, DATAMAX, lank );
  25.     time( &tme );
  26.     printf( "SORT_BUBBLE: %d data sorting time is %g[s](*100).\n", DATAMAX, difftime( tme, tms ) );
  27.  
  28.     time( &tms );
  29.     for( i=0; i<100; i++ )
  30.         sort( SORT_SHELL, SORT_SHORT, data, DATAMAX, lank );
  31.     time( &tme );
  32.     printf( "SORT_SHELL : %d data sorting time is %g[s](*100).\n", DATAMAX, difftime( tme, tms ) );
  33.  
  34.     return;
  35. }
  36.